/**
 * 实现地图
 * 创建者：Carburn Ashroom
 * 2022.12.14
 */

#include "background.h"

namespace Map {

    void Background::update()
    {
        pos += scroll;
        if (pos > pixmap.height())
            pos -= pixmap.height();
    }

    void Background::draw_this(QPixmap* pix) const
    {
        QPainter painter {pix};
        int pos_first {pos-pixmap.height()};
        painter.drawPixmap(0, pos_first, pixmap);
        painter.drawPixmap(0, pos, pixmap);
    }

}
